import 'package:flutter/material.dart';
import 'package:flutter_app/utils/windowUtil.dart';

class AppBarCustom extends StatefulWidget implements PreferredSizeWidget {
  String title;
  Widget right;
  AppBarCustom(this.title, {this.right});
  @override
  State<AppBarCustom> createState() => _AppBarCustomState();

  @override
  Size get preferredSize {
    return new Size.fromHeight(56.0 + windowUtil.statusbar);
  }
}

class _AppBarCustomState extends State<AppBarCustom> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return new Container(
        width: windowUtil.width,
        padding: EdgeInsets.only(top: windowUtil.statusbar),
        color: Color(0xff2c2825),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            GestureDetector(
              child: Container(
                child: Image.asset(
                  "images/arrleft2.png",
                ),
                padding: EdgeInsets.all(10.0),
                width: 50.0,
                height: 50.0,
              ),
              onTap: () {

             Navigator.pop(context);
              },
            ),
            Text(
              widget.title,
              style: TextStyle(color: Colors.white, fontSize: 19.0),
            ),
            Container(
              width: 50.0,
              height: 50.0,
              child: widget.right,
            )
          ],
        ));
  }
}
